import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: https://www.nowcoder.com/questionTerminal/2d3f6ddd82da445d804c95db22dcc471
 *
 * User: 86187
 * Date: 2022-10-10
 * Time: 19:15
 */
public class Test1 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        //长度给n+1防止越界

        int[] array = new int[n+1];
        for(int i = 0;i < n;i++) {
            array[i] = scan.nextInt();
        }
        int i = 0;
        int count = 0;
        while(i < n) {
            //进入非递减子序列
            if(array[i] < array[i+1]) {
                while(i < n && array[i] <= array[i+1]) {
                    i++;
                }
                count++;
                i++;
            }else if(array[i] == array[i+1]) {
                i++;
            }else {
                while(i < n && array[i] >= array[i+1]) {
                    i++;
                }
                count++;
                i++;
            }
        }
        System.out.println(count);
    }

}
